<?php
require_once $_site->get_viewpath("mobile/common/authcheck");
require_once $_site->get_viewpath("mobile/common/header");

//查询管理员信息
$admin_objet=new manager();
$cols='id,account,name,`group`,email,master,sex';
$admin_info=$admin_objet->admin_info($cols);
$pid=$admin_info['master']?$admin_info['master']:$admin_id;

$project_list=$admin_objet->project_search($pid);

//是否是管理员
$is_admin=is_admin($admin_id);
if($is_admin){
	$project_all=array_merge($project_list[1],$project_list[2]);	
	$admin_rtn=$admin_objet->admin_rtn($project_all,'uid','id,name');	
}
?>	
</head>

	<body>
		<div class="headertwo clearfloat" id="header">
			<a href="javascript:history.go(-1)" class="fl box-s"><i class="iconfont icon-arrow-l fl"></i></a>
			<p class="fl bt">工程项目</p>
            <a href="/mobile/center" class="fr"><i class="iconfont icon-gerenzhongxin fl"></i></a>			
		</div>
		
		<div class="clearfloat" id="main">
			<div class="schedule clearfloat">
				<div class="notice">
					<div class="tab-hd clearfloat">
						<ul class="tab-nav clearfloat">
						  <li><a href="#">进行中</a></li>
						  <li><a href="#">已结束</a></li>
						</ul>
					</div>
					<div class="tab-bd clearfloat">
						<div class="tab-pal">
					    	
					    	<?php
                                 if($project_list[1]){
                                    $i=1;
                                    foreach($project_list[1] as $val){
					    	?>
					    	<div class="content clearfloat box-s">
					    		<div class="list clearfloat fl box-s">					    									    			
						    			<div class="right clearfloat" style="width: 98%;">
						    				<div class="tit clearfloat">
						    					<p class="fl"><?php echo $val['title']?></p>	
                                                <span class="fr">No.<?php echo $i;?></span>												
						    				</div>
						    				<p class="recom-jianjie add"><i class="iconfont icon-map"></i><?php echo $val['address']?></p>
						    				<?php 
						    				   if($is_admin){
						    				?>
						    				<p class="recom-jianjie add"><i class="mui-icon mui-icon-person"></i><?php echo $admin_rtn[$val['uid']]['name'];?></p>
						    				<?php } ?>						    				
						    				<div class="recom-bottom clearfloat">								    				    				    					
						    					<span><i class="iconfont icon-time"></i> 
						    					<?php echo date('Y-m-d',$val['start_time']).' 至 '.date('Y-m-d',$val['end_time']) ?> 
						    					</span>
						    				</div>
						    			</div>					    			
					    		</div>

								<div class="topsche-top entrust box-s clearfloat">
									<a href="/mobile/recordcar?proid=<?php echo $val['id'];?>" class="tit fr entrust-btn">
										渣车计数
									</a>									
									<a href="/mobile/recordtime?proid=<?php echo $val['id'];?>" class="tit fr entrust-btn">
										挖机计时
									</a>								
									<a href="/mobile/record?proid=<?php echo $val['id'];?>" class="tit fr entrust-btn">
										挖机装车
									</a>
									<a href="/mobile/device?pid=<?php echo $val['id'];?>" class="tit fr entrust-btn rent-btn">
										设备
									</a>
								</div>								
					    		
					    	</div>					    	
					    	<?php $i++;}}else{ ?>
					    	
					    	<div class="empty-list clearfloat" id="main">
								<i class="iconfont icon-meineirong"></i>
								<p>没有找到相应项目！</p>
							 </div>					    	
					    	
					    	<?php } ?>	
					    	
						</div>
						
						<div class="tab-pal">
					    	
					    	<?php
                                 if($project_list[2]){
                                    $i=1;
                                    foreach($project_list[2] as $val){
					    	?>
					    	<div class="content clearfloat box-s">
					    		<div class="list clearfloat fl box-s">					    			
						    			<div class="right clearfloat" style="width: 98%;">
						    				<div class="tit clearfloat">
						    					<p class="fl"><?php echo $val['title']?></p>	
                                                <span class="fr">No.<?php echo $i;?></span>												
						    				</div>
						    				<p class="recom-jianjie add"><i class="iconfont icon-map"></i><?php echo $val['address']?></p>
						    				<?php 
						    				   if($is_admin){
						    				?>
						    				<p class="recom-jianjie add"><i class="mui-icon mui-icon-person"></i><?php echo $admin_rtn[$val['uid']]['name'];?></p>
						    				<?php } ?>							    				
						    				<div class="recom-bottom clearfloat">						    					
						    					<span><i class="iconfont icon-time"></i> 
						    					<?php echo date('Y-m-d',$val['start_time']).' 至 '.date('Y-m-d',$val['end_time']) ?> 
						    					</span>
						    				</div>
						    			</div>					    			
					    		</div>

								<div class="topsche-top entrust box-s clearfloat">
									<a href="/mobile/record?pid=<?php echo $val['id'];?>" class="tit fr entrust-btn">
										渣车计数
									</a>									
									<a href="/mobile/record?pid=<?php echo $val['id'];?>" class="tit fr entrust-btn">
										挖机计时
									</a>								
									<a href="/mobile/record?pid=<?php echo $val['id'];?>" class="tit fr entrust-btn">
										挖机装车
									</a>
									<a href="/mobile/device?pid=<?php echo $val['id'];?>" class="tit fr entrust-btn rent-btn">
										设备
									</a>
								</div>								
					    		
					    	</div>					    	
					    	<?php $i++;}}else{ ?>
					    	
							<div class="empty-list clearfloat" id="main">
								<i class="iconfont icon-meineirong"></i>
								<p>没有找到相应项目！</p>
							</div>					    	
					    	
					    	<?php } ?>	
					    	
						</div>
						
					</div>
				</div>
			</div>
		</div>
				
	</body>	
	<script type="text/javascript" src="/static/mobile/js/jquery.SuperSlide.2.1.js" ></script>
	<script type="text/javascript">
		jQuery(".notice").slide({ titCell:".tab-hd li", mainCell:".tab-bd",trigger: "click",delayTime:0 });
	</script>
</html>
